extends layout

block content
    h1 General
    div.panel.panel-default
        div.panel-body
            a(href="/Participations/#{data.PARTICIPATION_ID}") Participants
            form.form-horizontal(method="post" action="/Periodicals/#{data.ID}/update")
                div.form-group
                    label.col-sm-2.control-label Title:
                    div.col-sm-10: input.form-control(type="text" value="#{data.TITLE}" name="title")
                div.form-group
                    label.col-sm-2.control-label Opened:
                    div.col-sm-10: input.form-control(type="date" value="#{data.OPENED}" name="opened")
                div.form-group
                    label.col-sm-2.control-label Closed:
                    div.col-sm-10: input.form-control(type="date" value="#{data.CLOSED}" name="closed")
                div.form-group
                    label.col-sm-2.control-label Type:
                    div.col-sm-10: input.form-control(type="text" value="#{data.TYPE}" name="type")
                div.form-group 
                    div.col-sm-offset-2.col-sm-10: button.btn.btn-primary(type="submit") Save
    h1 Issues
    div.panel.panel-default
        div.panel-body
            div
                if !issues[0]
                    button.btn.btn-primary(data-toggle="modal" data-target="#myModal") Create
                table.table
                    if issues[0]
                        thead
                            tr
                                each value, key in issues[0]
                                    th= key
                                th
                                th
                                    span.glyphicon.glyphicon-pencil(data-toggle="modal" data-target="#myModal")
                    tbody
                        each row in issues
                            tr
                                each column in row
                                    td= column
                                td
                                    a(href='/Periodicals/#{p_id}/issue/#{row.ID}/delete') 
                                        span.glyphicon.glyphicon-trash
                                td
                                     a(href='/Issues/#{row.ID}/')
                                        span.glyphicon.glyphicon-folder-open
            div.paginator
                ul.pagination
                    - for(var i = 0; i < pages; i++)
                        if page == i
                            li.active: a(href='/Periodicals/#{p_id}/page#{i}') #{i}
                        else
                            li: a(href='/Periodicals/#{p_id}/page#{i}') #{i}

    div.modal.fade#myModal(tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true")
        div.modal-dialog
            div.modal-content
                div.modal-header
                    button.close(type="button" data-dismiss="modal" aria-hidden="true") &times;
                    h4.modal-title New issue
                br
                form.form-horizontal(method="post" action="/Periodicals/#{p_id}/issue/create")
                    div.form-group
                        label.col-sm-2.control-label Num:
                        div.col-sm-10: input.form-control(type="text" name="num")
                    div.form-group
                        label.col-sm-2.control-label Opened:
                        div.col-sm-10: input.form-control(type="date" name="release_date")
                    div.modal-footer
                        button.btn.btn-default(type="button" data-dismiss="modal") Close
                        button.btn.btn-primary(type="submit") Create
